<?
$allergies_reaction = set_value('allergies_reaction',$student->hhc_allergies_reaction);
$drug_allergies_reaction = set_value('drug_allergies_reaction',$student->hhc_alergic_med_reaction);
$eye_problem_spec = set_value('eye_problem_spec',$student->dhc_sight_problems_what);
$ear_problem_spec = set_value('ear_problem_spec',$student->dhc_hearing_problems_what);
$major_ailment = set_value('major_ailment',$student->hhc_diagnosed_specify);
$recently_hospitalized = set_value('recently_hospitalized',$student->hhc_recently_hospitalized);
$major_injury = set_value('major_injury',$student->hhc_major_injury_specify);
$medication_child_taking_spec = set_value('medication_child_taking_spec',$student->hhc_medication_school_hours);
$asthma_inhaler = set_value('asthma_inhaler',$student->hhc_asthma_inhaler);
$asthma = set_value('asthma',$student->hhc_asthma);

//CHECK if value updated , if yes check if approve, denied  or pending
/*
 * Function located at parent_helper
 */

$profile_request = isset($profile_request) ? $profile_request : false;
$req_id = isset($req_id) ? $req_id : 0;

$is_allergies_reaction = req_check_if_updated($req_id, 'hhc_allergies_reaction',$student->hhc_allergies_reaction, $profile_request);
$is_allergies_reaction = req_check_if_updated($req_id, 'hhc_allergies_reaction',$student->hhc_allergies_reaction, $profile_request);
$is_drug_allergies_reaction = req_check_if_updated($req_id, 'hhc_alergic_med_reaction',$student->hhc_alergic_med_reaction, $profile_request);
$is_eye_problem_spec = req_check_if_updated($req_id, 'dhc_sight_problems_what',$student->dhc_sight_problems_what, $profile_request);
$is_ear_problem_spec = req_check_if_updated($req_id, 'dhc_hearing_problems_what',$student->dhc_hearing_problems_what, $profile_request);
$is_major_ailment = req_check_if_updated($req_id, 'hhc_diagnosed_specify',$student->hhc_diagnosed_specify, $profile_request);
$is_recently_hospitalized = req_check_if_updated($req_id, 'hhc_recently_hospitalized',$student->hhc_recently_hospitalized, $profile_request);
$is_major_injury = req_check_if_updated($req_id, 'hhc_major_injury_specify',$student->hhc_major_injury_specify, $profile_request);
$is_medication_child_taking_spec = req_check_if_updated($req_id, 'hhc_medication_school_hours',$student->hhc_medication_school_hours, $profile_request);
$is_asthma_inhaler = req_check_if_updated($req_id, 'hhc_asthma_inhaler',$student->hhc_asthma_inhaler, $profile_request);
$is_asthma = req_check_if_updated($req_id, 'hhc_asthma',$student->hhc_asthma, $profile_request);
?>
<div>
<div class="panel callout"><h6>MEDICAL INFORMATION AND HEALTH HISTORY OF CHILD</h6></div>
	<?=form_open('',' class="custom profile_form" id ="health_history" ')?>
	<div>
		<label style="font-weight:bold;">1. Does your child have any of the following?</label>
	</div>
	<div>
		<label style="font-weight:bold;">Allergies (please specify if yes)</label> <?=$is_allergies_reaction->checkbox?>
		<input class="<?=$is_allergies_reaction->changed ? $is_allergies_reaction->class : '' ?>" type="text" name="allergies_reaction" value="<?=$allergies_reaction;?>">
	</div>
	<div class="clearfix"></div>
	<div>
		<label style="font-weight:bold;">Drug Allergies (please specify if yes)</label> <?=$is_drug_allergies_reaction->checkbox?>
		<input class="<?=$is_drug_allergies_reaction->changed ? $is_drug_allergies_reaction->class : '' ?>" type="text" name="drug_allergies_reaction" value="<?=$drug_allergies_reaction;?>">
	</div>
	<div class="clearfix"></div>
	<div>
		<div class="large-4 columns">
			<label style="font-weight:bold;">Asthma</label>
			<?=$is_asthma->checkbox?> <br/>
			<?php $aclass = $is_asthma->changed?$is_asthma->class:''; ?>
			<?php if($asthma!='no'){ ?><?=form_radio('asthma', 'no', '', "class='$aclass'");?><?php }else{ ?><?=form_radio('asthma', 'no', 'checked', "class='$aclass'");?><?php } ?> No <?php if($asthma=='yes'){ ?><?=form_radio('asthma', 'yes', 'checked', "class='$aclass'");?><?php }else{ ?><?=form_radio('asthma', 'yes', '', "class='$aclass'");?><?php } ?> Yes
		</div>
		<div class="large-8 columns">
			<label style="font-weight:bold;">Does your child carry an asthma inhaler?</label>
			<?=$is_asthma_inhaler->checkbox?> <br/>
			<?php $aiclass = $is_asthma_inhaler->changed?$is_asthma_inhaler->class:''; ?>
			<?php if($asthma_inhaler!='no'){ ?><?=form_radio('asthma_inhaler', 'no', '', "class='$aiclass'");?><?php }else{ ?><?=form_radio('asthma_inhaler', 'no', 'checked', "class='$aiclass'");?><?php } ?> No <?php if($asthma_inhaler=='yes'){ ?><?=form_radio('asthma_inhaler', 'yes', 'checked', "class='$aiclass'");?><?php }else{ ?><?=form_radio('asthma_inhaler', 'yes','', "class='$aiclass'");?><?php } ?> Yes
		</div>
	</div>
	<div class="clearfix"></div>
	<div>
		<label style="font-weight:bold;">Eye or Vision problem/s (please specify if yes)</label> <?=$is_eye_problem_spec->checkbox?>
		<textarea class="<?=$is_eye_problem_spec->changed ? $is_eye_problem_spec->class : '' ?>" name="eye_problem_spec"><?=$eye_problem_spec;?></textarea>
	</div>
	<div class="clearfix"></div>
	<div>
		<label style="font-weight:bold;">Ear or hearing problem/s (please specify if yes)</label> <?=$is_ear_problem_spec->checkbox?>
		<textarea class="<?=$is_ear_problem_spec->changed ? $is_ear_problem_spec->class : '' ?>" name="ear_problem_spec"><?=$ear_problem_spec;?></textarea>
	</div>
	<div>
		<label style="font-weight:bold;">2. Any other health condition that the school should be aware of (e.g. epilepsy, diabetes, etc)</label> <?=$is_major_ailment->checkbox?>
		<textarea class="<?=$is_major_ailment->changed ? $is_major_ailment->class : '' ?>" name="major_ailment"><?=$major_ailment;?></textarea>
	</div>
	<div class="clearfix"></div>
	<div>
		<label style="font-weight:bold;">3. Has your child recently been hospitalized? (please specify if yes)</label> <?=$is_recently_hospitalized->checkbox?>
		<textarea class="<?=$is_recently_hospitalized->changed ? $is_recently_hospitalized->class : '' ?>" name="recently_hospitalized"><?=$recently_hospitalized;?></textarea>
	</div>
	<div class="clearfix"></div>
	<div>
		<label style="font-weight:bold;">4. Has your child recently had any serious injuries? (please specify if yes)</label> <?=$is_major_injury->checkbox?>
		<textarea class="<?=$is_major_injury->changed ? $is_major_injury->class : '' ?>" name="major_injury"><?=$major_injury;?></textarea>
	</div>
	<div class="clearfix"></div>
	<div>
		<label style="font-weight:bold;">5. Is your child on a regular medication? if yes please specify medication and frequency.</label> <?=$is_medication_child_taking_spec->checkbox?>
		<textarea class="<?=$is_medication_child_taking_spec->changed ? $is_medication_child_taking_spec->class : '' ?>" name="medication_child_taking_spec"><?=$medication_child_taking_spec;?></textarea>
	</div>
	<div class="clearfix"></div>
	<div>
		<?=$is_medication_child_taking_spec->checkbox?> <br/>
		<?php $medclass = $is_medication_child_taking_spec->changed?$is_medication_child_taking_spec->class:''; ?>
		<label style="font-weight:bold;">6. Does your child need to take any medication/s during school hours?</label> <?php if($medication_child_taking_spec!='no'){ ?><?=form_radio('medication_child_taking_spec', 'no','', "class='$medclass'");?><?php }else{ ?><?=form_radio('medication_child_taking_spec', 'no', 'checked', "class='$medclass'");?><?php } ?> No <?php if($medication_child_taking_spec=='yes'){ ?><?=form_radio('medication_child_taking_spec', 'yes', 'checked', "class='$medclass'");?><?php }else{ ?><?=form_radio('medication_child_taking_spec', 'yes','', "class='$medclass'");?><?php } ?> Yes
	</div>
	<div class="clearfix"></div>
	<div style="font-weight:bold;">(If yes, a letter from the Medical Doctor must be submitted and will be kept on file. Medication/s will also be kept in the school and to be dispensed only by the teacher or authorized person.)</div>
	<div class="clearfix"></div>
	<div class="clearfix"></div>
		
	<?if(isset($student->edit) && $student->edit === 1):?>
			<div>
				<input type="hidden" name="profile_id" value="<?=$student->profile_id;?>">
				<input type="hidden" name="enrollment_id" value="<?=$student->enrollment_id;?>">
				<input type="hidden" name="update_health_history" value="true">
				<input type="submit" name="update_health_history" value="Update Student Health History" class="btn btn-primary">
			</div>
	<?endif;?>
	</form>
</div>